/*
 * BugetViewer.h
 *
 *  Created on: 2013-2-7
 *      Author: Dspark
 */

#ifndef BUGETVIEWER_H_
#define BUGETVIEWER_H_


#include "component/DynamicPie.h"
#include <qsplitter.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qgroupbox.h>
#include <qstandarditemmodel.h>
#include <qtableview.h>
#include <qlineedit.h>
#include <qtextedit.h>
#include <qpushbutton.h>
#include "BugetItemDialog.h"
#include "../bo/Buget.h"
#include "../utile/DAObject.h"

class BugetViewer : public QWidget{
	Q_OBJECT
public:
	BugetViewer(User& u, quint32 id, bool editable = true);
	virtual ~BugetViewer();
Q_SIGNALS:
	void sig_succeed();
protected Q_SLOTS:
	void slt_accept();
	void slt_reject();
protected:
	void save(bool accpet);
	void loadData();
	void loadItems();
	void initUI();
private:
	User& user;
	quint32 bid;
	bool editable;
	quint32 pid;
	QGridLayout layout;
	QSplitter pies;
	SolidPie totalPie;
	DynamicPie bugetPie;
	QLabel lab_total,lab_buget, lab_oa, lab_comment, lab_viewComment;
	QTextEdit viewComment;
	QTableView tab;
	QStandardItemModel tabModel;
	qreal total,buget,paid;
	QPushButton bt_accept,bt_reject;

};

#endif /* BUGETVIEWER_H_ */
